package com.ag.zlw.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ag.bean.TbUserState;
import com.ag.common.AgException;
import com.ag.common.IDUtil;
import com.ag.common.IIDService;
import com.ag.zlw.dao.TbUserStateDAO;
import com.ag.zlw.service.UserStateService;

/**
 * 用户状态
 * 
 * @author 钟龙伟
 * 
 */

@Service("UserStateService")
public class UserStateServiceImpl implements UserStateService {
	@Resource(name = "ZLWTbUserStateDAO")
	private TbUserStateDAO tbUserStateDAO;

	private String IDs;
	@Resource(name = "iDServiceImpl")
	private IIDService idservice;

	public void save(TbUserState UserState) throws AgException {
		IDs = (String) idservice.findTablePK(IDUtil.TB_USER_STATE);
		UserState.setUsId(IDs);
		tbUserStateDAO.save(UserState);
	}

	public void delete(TbUserState UserState) {
		TbUserState tbUserState = tbUserStateDAO.findById(UserState.getUsId());
		tbUserState.setA(IDUtil.DELETE);
		tbUserStateDAO.attachDirty(tbUserState);
	}

	public List<TbUserState> findAll() {
		return tbUserStateDAO.findAll();
	}

	public void modify(TbUserState UserState) {
		tbUserStateDAO.attachDirty(UserState);
	}
}
